package com.bootsecurity.security.config;

import com.bootsecurity.security.util.MD5Util;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * Created with IntelliJ IDEA.
 * Description:  这里处理密码
 * User: liubin
 * Date: 2018-01-03
 * Time: 下午 6:28
 * @author 001030
 */
public class MyPasswordEncoder implements PasswordEncoder {


    @Override
    public String encode(CharSequence arg0) {
        return MD5Util.encode((String)arg0);
        //return arg0.toString();
    }

    @Override
    public boolean matches(CharSequence arg0, String arg1) {
        return arg1.equals(MD5Util.encode((String)arg0));
        //return arg1.equals(arg0.toString());
    }
}
